package com.atguigu.demo.customer0222.service.impl;

import com.atguigu.demo.customer0222.bean.Customer;
import com.atguigu.demo.customer0222.mapper.CustomerMapper;
import com.atguigu.demo.customer0222.service.CustomerService;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@DS("demo")
public class CustomerServiceImpl  extends ServiceImpl<CustomerMapper,Customer> implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;


    @Override
    public void saveCustomer(Customer customer) {
      //  customerMapper.insertCustomer(customer);
        customerMapper.insert(customer);

        System.out.println("save customer :"+customer);
    }

    @Override
    public List<Customer> getCustomerByAge(Integer age) {
        List<Customer> customerList = customerMapper.selectCustomerByAge(age);
        return customerList;
    }
}
